#include <iostream>
#include <vector>
#include <queue>

using namespace std;
const int N = 1010;
int k, n, m;

vector<int> edges[N];
int c[N];
int cnt[N];
void bfs(int i)
{
	queue<int>q;
	q.push(i);
	bool st[N] = { false };
	st[i] = true;
	while (q.size())
	{
		int u = q.front(); q.pop();
		cnt[u]++;
		for (auto v : edges[u])
		{
			if (!st[v])
			{
				q.push(v);
				st[v] = true;
			}
		}
	}
}
int main()
{
	cin >> k >> n >> m;
	for (int i = 1; i <= k; i++) cin >> c[i];

	for (int i = 1; i <= m; i++)
	{
		int u, v; cin >> u >> v;
		edges[u].push_back(v);
	}

	for (int i = 1; i <= k; i++)
	{
		bfs(c[i]);
	}
	int ret = 0;
	for (int i = 1; i <= n; i++)
	{
		if (cnt[i] == k) ret++;
	}
	cout << ret << endl;
	return 0;
}